package top.lshaci.learning.springboot.security.web.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * PermissionController
 *
 * @author lshaci
 * @since 1.0.0
 */
@RestController
@RequestMapping("/permission")
public class PermissionController {

    @GetMapping("/p1")
    @PreAuthorize("hasAuthority('p1')")
    public String p1() {
        return "测试权限1";
    }

    @GetMapping("/p2")
    @PreAuthorize("hasAuthority('p2')")
    public String p2() {
        return "测试权限2";
    }
}
